/**合并行*/
export function mergeTableRow(data, merge) {
    if (!merge || merge.length === 0) {
        return data
    }
    // let resultArray = [];
    let j = -1;
    merge.forEach(m => {
        const mList = {}
        let i = 0;
        const lastCol = j > -1 ? merge[j] : '';
        j++;
        data = data.map((v, index) => {
            const rowVal = v[m];
            if (lastCol) {
                if (mList[rowVal] && mList[rowVal].newIndex === index && v[`${lastCol}-span`]['rowspan'] === 0) {
                    mList[rowVal]['num']++
                        mList[rowVal]['newIndex']++
                        data[mList[rowVal]['index']][m + '-span'].rowspan++
                        v[m + '-span'] = {
                            rowspan: 0,
                            colspan: 0
                        }
                } else {
                    mList[rowVal] = { num: 1, index: index, newIndex: index + 1 }
                    v[m + '-span'] = {
                        rowspan: 1,
                        colspan: 1
                    }
                }
            } else {
                if (mList[rowVal] && mList[rowVal].newIndex === index) {
                    mList[rowVal]['num']++
                        mList[rowVal]['newIndex']++
                        data[mList[rowVal]['index']][m + '-span'].rowspan++
                        v[m + '-span'] = {
                            rowspan: 0,
                            colspan: 0
                        }
                } else {
                    mList[rowVal] = { num: 1, index: index, newIndex: index + 1 }
                    v[m + '-span'] = {
                        rowspan: 1,
                        colspan: 1
                    }
                }
            }

            return v;
        })
    })

    return data;
}